<!--

    Copyright (C) 2015 The Gravitee team (http://gravitee.io)

    Licensed under the Apache License, Version 2.0 (the "License");
    you may not use this file except in compliance with the License.
    You may obtain a copy of the License at

            http://www.apache.org/licenses/LICENSE-2.0

    Unless required by applicable law or agreed to in writing, software
    distributed under the License is distributed on an "AS IS" BASIS,
    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    See the License for the specific language governing permissions and
    limitations under the License.

-->
<div class="gio-instance-details-environment">
  <div class="gio-instance-details-environment__cards">
    <mat-card class="gio-instance-details-environment__cards__card">
      <mat-card-content>
        <h2 gioTableOfContents gioTableOfContentsName="Information" class="gio-instance-details-environment__cards__card__title">
          <mat-icon svgIcon="gio:info"></mat-icon>
          <span>Information</span>
        </h2>
      </mat-card-content>
      <gio-table-wrapper
        *ngIf="filteredInformationItemsDS"
        [length]="informationTableUnpaginatedLength"
        [filters]="informationTableFilters"
        (filtersChange)="onInformationFiltersChanged($event)"
      >
        <table
          mat-table
          [dataSource]="filteredInformationItemsDS"
          matSort
          class="information-table"
          id="informationTable"
          aria-label="Information table"
        >
          <!-- Icon Column -->
          <ng-container matColumnDef="icon">
            <th mat-header-cell *matHeaderCellDef></th>
            <td mat-cell *matCellDef="let info">
              <mat-icon *ngIf="info.icon" [svgIcon]="info.icon"></mat-icon>
            </td>
          </ng-container>

          <!-- Type Column -->
          <ng-container matColumnDef="type">
            <th mat-header-cell *matHeaderCellDef mat-sort-header sortActionDescription="Sort by type">Type</th>
            <td mat-cell *matCellDef="let info">{{ info.type }}</td>
          </ng-container>

          <!-- Value Column -->
          <ng-container matColumnDef="value">
            <th mat-header-cell *matHeaderCellDef mat-sort-header sortActionDescription="Sort by value">Value</th>
            <td mat-cell *matCellDef="let info" [ngClass]="info.class">{{ info.value }}</td>
          </ng-container>

          <tr mat-header-row *matHeaderRowDef="informationTableDisplayedColumns"></tr>
          <tr mat-row *matRowDef="let row; columns: informationTableDisplayedColumns"></tr>

          <tr class="mat-mdc-row mdc-data-table__row" *matNoDataRow>
            <td class="mat-mdc-cell mdc-data-table__cell" [attr.colspan]="informationTableDisplayedColumns.length">No information</td>
          </tr>
        </table>
      </gio-table-wrapper>
    </mat-card>
    <mat-card class="gio-instance-details-environment__cards__card">
      <mat-card-content>
        <h2 gioTableOfContents gioTableOfContentsName="Plugins" class="gio-instance-details-environment__cards__card__title">
          <mat-icon svgIcon="gio:puzzle"></mat-icon>
          <span>Plugins</span>
        </h2>
      </mat-card-content>
      <gio-table-wrapper
        *ngIf="filteredPluginsItemsDS"
        [length]="pluginsTableUnpaginatedLength"
        [filters]="pluginsTableFilters"
        (filtersChange)="onPluginsFiltersChanged($event)"
      >
        <table mat-table [dataSource]="filteredPluginsItemsDS" matSort class="plugins-table" id="pluginsTable" aria-label="Plugin table">
          <!-- Icon Column -->
          <ng-container matColumnDef="icon">
            <th mat-header-cell *matHeaderCellDef></th>
            <td mat-cell *matCellDef="let plugin">
              <mat-icon *ngIf="plugin.icon" [svgIcon]="plugin.icon"></mat-icon>
            </td>
          </ng-container>

          <!-- ID Column -->
          <ng-container matColumnDef="id">
            <th mat-header-cell *matHeaderCellDef mat-sort-header sortActionDescription="Sort by ID">ID</th>
            <td mat-cell *matCellDef="let plugin">{{ plugin.id }}</td>
          </ng-container>

          <!-- Name Column -->
          <ng-container matColumnDef="name">
            <th mat-header-cell *matHeaderCellDef mat-sort-header sortActionDescription="Sort by name">Name</th>
            <td mat-cell *matCellDef="let plugin">{{ plugin.name }}</td>
          </ng-container>

          <!-- Version Column -->
          <ng-container matColumnDef="version">
            <th mat-header-cell *matHeaderCellDef mat-sort-header sortActionDescription="Sort by version">Version</th>
            <td mat-cell *matCellDef="let plugin">{{ plugin.version }}</td>
          </ng-container>

          <tr mat-header-row *matHeaderRowDef="pluginsTableDisplayedColumns"></tr>
          <tr mat-row *matRowDef="let row; columns: pluginsTableDisplayedColumns"></tr>

          <tr class="mat-mdc-row mdc-data-table__row" *matNoDataRow>
            <td class="mat-mdc-cell mdc-data-table__cell" [attr.colspan]="pluginsTableDisplayedColumns.length">No plugin</td>
          </tr>
        </table>
      </gio-table-wrapper>
    </mat-card>
    <mat-card class="gio-instance-details-environment__cards__card">
      <mat-card-content>
        <h2 gioTableOfContents gioTableOfContentsName="System properties" class="gio-instance-details-environment__cards__card__title">
          <mat-icon svgIcon="gio:list"></mat-icon>
          <span>System properties</span>
        </h2>
      </mat-card-content>
      <gio-table-wrapper
        *ngIf="filteredPropertiesItemsDS"
        [length]="propertiesTableUnpaginatedLength"
        [filters]="propertiesTableFilters"
        (filtersChange)="onPropertiesFiltersChanged($event)"
      >
        <table
          mat-table
          [dataSource]="filteredPropertiesItemsDS"
          matSort
          class="properties-table"
          id="propertiesTable"
          aria-label="Properties table"
        >
          <!-- Name Column -->
          <ng-container matColumnDef="name">
            <th mat-header-cell *matHeaderCellDef mat-sort-header sortActionDescription="Sort by name">Name</th>
            <td mat-cell *matCellDef="let property">{{ property.name }}</td>
          </ng-container>

          <!-- Version Column -->
          <ng-container matColumnDef="value">
            <th mat-header-cell *matHeaderCellDef mat-sort-header sortActionDescription="Sort by value">Value</th>
            <td mat-cell *matCellDef="let property">{{ property.value }}</td>
          </ng-container>

          <tr mat-header-row *matHeaderRowDef="propertiesTableDisplayedColumns"></tr>
          <tr mat-row *matRowDef="let row; columns: propertiesTableDisplayedColumns"></tr>

          <tr class="mat-mdc-row mdc-data-table__row" *matNoDataRow>
            <td class="mat-mdc-cell mdc-data-table__cell" [attr.colspan]="propertiesTableDisplayedColumns.length">No property</td>
          </tr>
        </table>
      </gio-table-wrapper>
    </mat-card>
  </div>

  <gio-table-of-contents
    class="gio-instance-details-environment__toc"
    [sectionNames]="{ '': 'Environment' }"
    scrollingContainer="#gio-toc-scrolling-container"
  ></gio-table-of-contents>
</div>
